<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>.Net Core HttpClient 忽略https证书提醒 | James&#39;s Blog -- 脑洞的蜂蜜</title>
  <meta name="keywords" content=" .Net Core ">
  <meta name="description" content=".Net Core HttpClient 忽略https证书提醒 | James&#39;s Blog -- 脑洞的蜂蜜">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="自我介绍  十年的开发经验和项目管理经验，具有较强的编程能力和逻辑分析能力，对.Net， .Net Core, Java有一定的了解和接触。多年的经验，接触过各类的项目架构，单体架构、分布式架构、SOA、微服务架构等等。能够按照项目需求，能够及时对产品进行分析，并分配研发工作。在团队中能做一定的技术指导，对于一些线上问题，都能及时找到解决方案并解决。 先后曾任职于5173、盛大文学、IPS、百强旅">
<meta property="og:type" content="website">
<meta property="og:title" content="关于我-脑洞的蜂蜜">
<meta property="og:url" content="http://www.jamesying.com/about/index.html">
<meta property="og:site_name" content="James&#39;s Blog -- 脑洞的蜂蜜">
<meta property="og:description" content="自我介绍  十年的开发经验和项目管理经验，具有较强的编程能力和逻辑分析能力，对.Net， .Net Core, Java有一定的了解和接触。多年的经验，接触过各类的项目架构，单体架构、分布式架构、SOA、微服务架构等等。能够按照项目需求，能够及时对产品进行分析，并分配研发工作。在团队中能做一定的技术指导，对于一些线上问题，都能及时找到解决方案并解决。 先后曾任职于5173、盛大文学、IPS、百强旅">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-09-30T05:35:41.000Z">
<meta property="article:modified_time" content="2020-09-30T12:28:35.633Z">
<meta property="article:author" content="脑洞的蜂蜜">
<meta property="article:tag" content="架构师 重构师 面对未知勇于挑战">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/fav.jpg">

<link href="/css/style.css?v=1.1.0" rel="stylesheet">

<link href="/css/hl_theme/atom-dark.css?v=1.1.0" rel="stylesheet">

<link href="//cdn.jsdelivr.net/npm/animate.css@4.1.0/animate.min.css" rel="stylesheet">

<script src="//cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="/js/titleTip.js?v=1.1.0" ></script>

<script src="//cdn.jsdelivr.net/npm/highlightjs@9.16.2/highlight.pack.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script>



<script src="/js/iconfont.js?v=1.1.0" ></script>

<meta name="generator" content="Hexo 5.2.0"><link rel="alternate" href="/atom.xml" title="James's Blog -- 脑洞的蜂蜜" type="application/atom+xml">
</head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="">
  <input class="theme_blog_path" value="">
  <input id="theme_shortcut" value="true" />
  <input id="theme_highlight_on" value="true" />
  <input id="theme_code_copy" value="true" />
</div>



<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/" class="avatar_target">
    <img class="avatar" src="/img/header.jpg" />
</a>
<div class="author">
    <span>脑洞的蜂蜜</span>
</div>
<div class="desc">
    <span>
        胜寒会员，从事Asp.Net开发13年，先后曾任职于5173、盛大文学、IPS、百强旅游公司，Softtek担任技术开发工作，目前就职于【华住集团】，担任架构师，为易系列.Net 产品负责研发工作。开源项目“微信快速开发框架”负责人，目前正在研究.Net Core与微服务架构。
    </span>
</div>
<div class="icon">
    
        
        <a title="rss" href="/atom.xml" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-rss"></use>
                </svg>
            
        </a>
        
    
        
        <a title="github" href="https://github.com/jamesying" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
        <a title="csdn" href="https://inday.cnblogs.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-csdn"></use>
                </svg>
            
        </a>
        
    
        
    
        
    
        
        <a title="email" href="mailto:james@taogame.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=785418&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
        
    
        
    
</div>




<ul>
    <li><div class="all active" data-rel="全部文章">全部文章<small>(11)</small></div></li>
    
        
            
            <li><div data-rel="架构">架构<small>(1)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel=".Net_Core">.Net_Core<small>(5)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="微服务">微服务<small>(1)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="abp">abp<small>(1)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="日常生活">日常生活<small>(3)</small></div>
                
            </li>
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="11">
<input type="hidden" id="yelog_site_word_count" value="10.1k">
<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="iconfont icon-left"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
            <li><a target="_blank" href="http://www.shenghan.org/">胜寒俱乐部</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <div class="right-top">
        <div id="default-panel">
            <i class="iconfont icon-search" data-title="搜索 快捷键 i"></i>
            <div class="right-title">全部文章</div>
            <i class="iconfont icon-file-tree" data-title="切换到大纲视图 快捷键 w"></i>
        </div>
        <div id="search-panel">
            <i class="iconfont icon-left" data-title="返回"></i>
            <input id="local-search-input" />
            <label class="border-line" for="input"></label>
            <i class="iconfont icon-case-sensitive" data-title="大小写敏感"></i>
            <i class="iconfont icon-tag" data-title="标签"></i>
        </div>
        <div id="outline-panel" style="display: none">
            <div class="right-title">大纲</div>
            <i class="iconfont icon-list" data-title="切换到文章列表"></i>
        </div>
    </div>

    <div class="tags-list">
    <input id="tag-search" />
    <div class="tag-wrapper">
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>.Net Core</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>多时区</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>生活</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>微信</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>abp</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>Asp.Net Core</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>DI</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>hangfire</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>Kestrel</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>SignalR</a>
            </li>
        
    </div>

</div>

    
    <nav id="title-list-nav">
        
        <a  class="全部文章 日常生活 "
           href="/2020/11/13/life-2020-11-13-1/"
           data-tag="生活"
           data-author="" >
            <span class="post-title" title="生活即将进入一个新的阶段">生活即将进入一个新的阶段</span>
            <span class="post-date" title="2020-11-13 19:00:00">2020/11/13</span>
        </a>
        
        <a  class="全部文章 日常生活 "
           href="/2020/10/06/life-2020-10-06/"
           data-tag="生活"
           data-author="" >
            <span class="post-title" title="假期余额已经不足">假期余额已经不足</span>
            <span class="post-date" title="2020-10-06 21:39:56">2020/10/06</span>
        </a>
        
        <a  class="全部文章 架构 "
           href="/2020/10/02/think-about-multiple-timezone/"
           data-tag="生活,多时区"
           data-author="" >
            <span class="post-title" title="关于多时区引发一系列的问题">关于多时区引发一系列的问题</span>
            <span class="post-date" title="2020-10-02 17:13:02">2020/10/02</span>
        </a>
        
        <a  class="全部文章 日常生活 "
           href="/2020/09/30/life-2020-09-30/"
           data-tag="生活"
           data-author="" >
            <span class="post-title" title="记录在2020年国庆之前">记录在2020年国庆之前</span>
            <span class="post-date" title="2020-09-30 15:14:13">2020/09/30</span>
        </a>
        
        <a  class="全部文章 abp "
           href="/2020/09/20/Use-mysql-on-abp-vnext%20copy/"
           data-tag="Asp.Net Core,SignalR,微信,abp"
           data-author="" >
            <span class="post-title" title="Abp vNext 切换MySql数据库">Abp vNext 切换MySql数据库</span>
            <span class="post-date" title="2020-09-20 00:00:00">2020/09/20</span>
        </a>
        
        <a  class="全部文章 .Net_Core "
           href="/2020/09/02/hangfire-di-on-dot-net-core/"
           data-tag=".Net Core,DI,hangfire"
           data-author="" >
            <span class="post-title" title="在Asp.Net Core中使用DI的方式使用Hangfire构建后台执行脚本">在Asp.Net Core中使用DI的方式使用Hangfire构建后台执行脚本</span>
            <span class="post-date" title="2020-09-02 21:06:14">2020/09/02</span>
        </a>
        
        <a  class="全部文章 .Net_Core "
           href="/2020/09/02/signalr-wechat-miniapp/"
           data-tag=".Net Core,SignalR"
           data-author="" >
            <span class="post-title" title="Asp.Net Core SignalR 与微信小程序交互笔记">Asp.Net Core SignalR 与微信小程序交互笔记</span>
            <span class="post-date" title="2020-09-02 15:09:05">2020/09/02</span>
        </a>
        
        <a  class="全部文章 .Net_Core "
           href="/2020/09/01/signalR-core-grace-call-client-methods/"
           data-tag=".Net Core,SignalR"
           data-author="" >
            <span class="post-title" title="Asp.Net Core SignalR 用泛型Hub优雅的调用前端方法及传参">Asp.Net Core SignalR 用泛型Hub优雅的调用前端方法及传参</span>
            <span class="post-date" title="2020-09-01 15:07:23">2020/09/01</span>
        </a>
        
        <a  class="全部文章 .Net_Core "
           href="/2020/08/30/Make-a-docker-image-for-ocelot/"
           data-tag="Asp.Net Core,Kestrel,.Net Core"
           data-author="" >
            <span class="post-title" title="给Ocelot打造一个Docker镜像">给Ocelot打造一个Docker镜像</span>
            <span class="post-date" title="2020-08-30 11:28:10">2020/08/30</span>
        </a>
        
        <a  class="全部文章 微服务 "
           href="/2020/04/30/Single-Service-Architecture-Intro/"
           data-tag="Asp.Net Core,Kestrel,.Net Core"
           data-author="" >
            <span class="post-title" title="单体服务架构-一种新型的适合中小型企业的服务架构">单体服务架构-一种新型的适合中小型企业的服务架构</span>
            <span class="post-date" title="2020-04-30 00:00:00">2020/04/30</span>
        </a>
        
        <a  class="全部文章 .Net_Core "
           href="/2019/10/02/ignore-https-warning/"
           data-tag=".Net Core"
           data-author="" >
            <span class="post-title" title=".Net Core HttpClient 忽略https证书提醒">.Net Core HttpClient 忽略https证书提醒</span>
            <span class="post-date" title="2019-10-02 21:04:19">2019/10/02</span>
        </a>
        
        <div id="no-item-tips">

        </div>
    </nav>
    <div id="outline-list">
    </div>
</div>
    </div>
    <div class="hide-list">
        <div class="semicircle" data-title="切换全屏 快捷键 s">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div id="post">
    <div class="pjax">
        <article id="post-ignore-https-warning" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">.Net Core HttpClient 忽略https证书提醒</h1>
    
    <div class="article-meta">
        
        
        
        <span class="book">
            <i class="iconfont icon-category"></i>
            
            
            <a  data-rel=".Net_Core">.Net_Core</a>
            
        </span>
        
        
        <span class="tag">
            <i class="iconfont icon-tag"></i>
            
            <a class="color5">.Net Core</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
            发布时间 : <time class="date" title='最后更新: 2020-10-02 21:05:22'>2019-10-02 21:04</time>
        
    </div>
    <div class="article-meta">
        
        <span>字数:55</span>
        
        
        <span id="busuanzi_container_page_pv">
            阅读 :<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
        <span class="top-comment" title="跳转至评论区">
            <a href="#comments">
                评论:<span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </a>
        </span>
        
    </div>
    
    <div class="toc-ref">
    
        
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>

    
    <div class="article-entry" itemprop="articleBody">
      
        <p>在测试中经常会遇到请求一些https的url,但又没有本地证书,这时候可以用下面的方法忽略警告</p>
<pre><code>    var httpclientHandler = new HttpClientHandler();
    httpclientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, error) =&gt; true;
    var httpClient = new HttpClient(httpclientHandler);</code></pre>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的引用来源进行考证，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 james@taogame.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>.Net Core HttpClient 忽略https证书提醒</p>
    <p><span class="copy-title">字数:</span><span class="post-count">55</span></p>
    <p><span class="copy-title">本文作者:</span><a  title="脑洞的蜂蜜">脑洞的蜂蜜</a></p>
    <p><span class="copy-title">发布时间:</span>2019-10-02, 21:04:19</p>
    <p><span class="copy-title">最后更新:</span>2020-10-02, 21:05:22</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/2019/10/02/ignore-https-warning/" title=".Net Core HttpClient 忽略https证书提醒">http://www.jamesying.com/2019/10/02/ignore-https-warning/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">&#34;署名-非商用-相同方式共享 4.0&#34;</a> 转载请保留原文链接及作者。
    </p>
</div>



    <div id="comments">
    <script src="https://utteranc.es/client.js"
            repo="JamesYing/BlogsRelatedCodes"
            issue-term="title"
            theme="github-light"
            label="jamesblog"
            crossorigin="anonymous"
            async>
    </script>
</div>




    




    </div>
    <div class="copyright">
        <p class="footer-entry">
    ©2016-2020 JamesBlog
</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full" data-title="切换全屏 快捷键 s"><span class="min "></span></button>
<a class="" id="rocket" ></a>

    </div>
</div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/img/alipay.png" class="alipay" title="扫码支持">
            <img src="/img/weixin.png" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/js/jquery.pjax.js?v=1.1.0" ></script>

<script src="/js/script.js?v=1.1.0" ></script>
<script>
    var img_resize = 'default';
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $("#post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().trim().split('\n').length, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?544cb2dafda458d911911b76a3b1d65d";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: ;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 722px;
    }
    .nav.fullscreen {
        margin-left: -722px;
    }
    .nav-left {
        width: 300px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 632px;
        }
        .nav.fullscreen {
            margin-left: -632px;
        }
        .nav-left {
            width: 240px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 632px;
            margin-left: -632px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    
    #post .pjax article .article-entry>ol, #post .pjax article .article-entry>ul, #post .pjax article>ol, #post .pjax article>ul{
        border: #e2dede solid 1px;
        border-radius: 10px;
        padding: 10px 32px 10px 56px;
    }
    #post .pjax article .article-entry li>ol, #post .pjax article .article-entry li>ul,#post .pjax article li>ol, #post .pjax article li>ul{
        padding-top: 5px;
        padding-bottom: 5px;
    }
    #post .pjax article .article-entry>ol>li, #post .pjax article .article-entry>ul>li,#post .pjax article>ol>li, #post .pjax article>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    #post .pjax article .article-entry li>ol>li, #post .pjax article .article-entry li>ul>li,#post .pjax article li>ol>li, #post .pjax article li>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    

    /* 背景图样式 */
    
    #post {
        background: url(https://images.pexels.com/photos/546819/pexels-photo-546819.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=2&amp;h=750&amp;w=1260);
    }
    
    
    #post .index {
        background: url(https://images.pexels.com/photos/963486/pexels-photo-963486.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=2&amp;h=750&amp;w=1260);
    }
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    

    
</style>







</html>
